import time
from base import Base
from selenium.webdriver.common.by import By

class TestJS(Base):
    def test_js(self):
        self.driver.get('https://www.baidu.com/')
        time.sleep(3)
        self.driver.find_element(By.ID,'kw').send_keys('selenium测试')
        self.driver.find_element(By.ID,'su').click()
        time.sleep(3)
        self.driver.execute_script('document.documentElement.scrollTop=10000')
        time.sleep(5)
        self.driver.find_element(By.XPATH,'//*[@id="page"]/div/a[10]').click()

        for code in {'return document.title','return JSON.stringify(performance.timing)'}:
            print(self.driver.execute_script(code))
